#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<thread>
#include<mutex>

using namespace std;

class Singleton1
{
public:
	Singleton1(const Singleton1& s) = delete;
	Singleton1& operator=(const Singleton1& s) = delete;

	static Singleton1& getInstance()
	{
		static Singleton1 instance;
		return instance;
	}

private:
	Singleton1()
	{}
};

class Singleton2
{
public:
	Singleton2(const Singleton2& s) = delete;
	Singleton2& operator=(const Singleton2& s) = delete;

	Singleton2* getInstance()
	{
		if (!instance)
		{
			lock_guard<mutex> guard(lock);
			if (!instance)
			{
				instance = new Singleton2();
			}
		}
		return instance;
	}

private:
	Singleton2* instance;
	mutex lock;

	Singleton2()
	{}
};

int minSubArrayLen(int target, vector<int>& nums) {
	int l = 0, r = 0;
	int n = nums.size();
	int t = 0, res = INT_MAX;
	while (r < n)
	{
		while (r < n && t < target)
			t += nums[r++];
		if (t < target)  break;
		while (l < n && t >= target)
			t -= nums[l++];
		res = min(res, r - l + 1);
	}
	return res == INT_MAX ? 0 : res;
}

int main()
{
	auto& instance = Singleton1::getInstance();
	return 0;
}